/*
 * vMatch.java
 *
 * Created on November 26, 2007, 9:58 PM
 */

package bbos.Match.Views;

import bbos.Match.Model.Actions.daMove;
import bbos.Match.Model.Actions.daFoul;
import bbos.Match.Model.Actions.daBlitz;
import bbos.Match.Model.Actions.daPass;
import bbos.Match.Model.Actions.daHandOff;
import bbos.Match.Model.Actions.daBlock;
import bbos.Match.Model.dMatch;
import bbos.Match.Model.dPlayer;
import bbos.*;
import bbos.Match.Model.Actions.dAction;
import javax.swing.*;
import java.awt.*;

import java.util.*;

/**
 *
 * @author  moi
 */
public class vMatch extends javax.swing.JPanel
{
    dMatch _model;
    
    
    /** Creates new form vMatch */
    public vMatch()
    {
        initComponents();
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        vRightGround1 = new javax.swing.JPanel();
        jpnSubWest = new javax.swing.JPanel();
        jPanel2 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jlbRerollRight = new javax.swing.JLabel();
        jlbTurnRight = new javax.swing.JLabel();
        jlbRerollLeft = new javax.swing.JLabel();
        jlbTurnLeft = new javax.swing.JLabel();
        jpnScore = new javax.swing.JPanel();
        jlbScoreRight = new javax.swing.JLabel();
        jlbScoreLeft = new javax.swing.JLabel();
        jPanel3 = new javax.swing.JPanel();
        jbtEndTurn = new javax.swing.JButton();
        jPanel4 = new javax.swing.JPanel();
        jpnActions = new javax.swing.JPanel();
        jbtMove = new javax.swing.JToggleButton();
        jbtBlock = new javax.swing.JToggleButton();
        jbtBlitz = new javax.swing.JToggleButton();
        jbtPass = new javax.swing.JToggleButton();
        jbtHandoff = new javax.swing.JToggleButton();
        jbtFoul = new javax.swing.JToggleButton();
        jPanel6 = new javax.swing.JPanel();
        jPanel5 = new javax.swing.JPanel();
        jbt2D6 = new javax.swing.JButton();
        jbt1D6 = new javax.swing.JButton();
        jbt3D6 = new javax.swing.JButton();

        setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        vRightGround1.setPreferredSize(new java.awt.Dimension(100, 60));
        vRightGround1.setLayout(new java.awt.BorderLayout());

        jpnSubWest.setLayout(new java.awt.BorderLayout());

        jPanel2.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
        jPanel2.setLayout(new java.awt.GridLayout(3, 2, 2, 0));

        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel1.setText("Reroll");
        jPanel2.add(jLabel1);

        jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel2.setText("Turn");
        jPanel2.add(jLabel2);

        jlbRerollRight.setFont(new java.awt.Font("Tahoma", 1, 18));
        jlbRerollRight.setForeground(java.awt.Color.blue);
        jlbRerollRight.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jlbRerollRight.setText("2");
        jPanel2.add(jlbRerollRight);

        jlbTurnRight.setFont(new java.awt.Font("Tahoma", 1, 18));
        jlbTurnRight.setForeground(java.awt.Color.blue);
        jlbTurnRight.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jlbTurnRight.setText("2");
        jPanel2.add(jlbTurnRight);

        jlbRerollLeft.setFont(new java.awt.Font("Tahoma", 1, 18));
        jlbRerollLeft.setForeground(java.awt.Color.red);
        jlbRerollLeft.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jlbRerollLeft.setText("2");
        jPanel2.add(jlbRerollLeft);

        jlbTurnLeft.setFont(new java.awt.Font("Tahoma", 1, 18));
        jlbTurnLeft.setForeground(java.awt.Color.red);
        jlbTurnLeft.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jlbTurnLeft.setText("2");
        jPanel2.add(jlbTurnLeft);

        jpnSubWest.add(jPanel2, java.awt.BorderLayout.CENTER);

        jpnScore.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Score", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION));

        jlbScoreRight.setFont(new java.awt.Font("Tahoma", 1, 36));
        jlbScoreRight.setForeground(java.awt.Color.blue);
        jlbScoreRight.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jlbScoreRight.setText("0");

        jlbScoreLeft.setFont(new java.awt.Font("Tahoma", 1, 36));
        jlbScoreLeft.setForeground(java.awt.Color.red);
        jlbScoreLeft.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jlbScoreLeft.setText("0");

        javax.swing.GroupLayout jpnScoreLayout = new javax.swing.GroupLayout(jpnScore);
        jpnScore.setLayout(jpnScoreLayout);
        jpnScoreLayout.setHorizontalGroup(
            jpnScoreLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jpnScoreLayout.createSequentialGroup()
                .addComponent(jlbScoreLeft, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 8, Short.MAX_VALUE)
                .addComponent(jlbScoreRight, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE))
        );
        jpnScoreLayout.setVerticalGroup(
            jpnScoreLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpnScoreLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(jlbScoreRight, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addComponent(jlbScoreLeft, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        jpnSubWest.add(jpnScore, java.awt.BorderLayout.NORTH);

        vRightGround1.add(jpnSubWest, java.awt.BorderLayout.NORTH);

        jPanel3.setPreferredSize(new java.awt.Dimension(100, 30));

        jbtEndTurn.setText("Validate");
        jbtEndTurn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtEndTurnActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jbtEndTurn, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 100, Short.MAX_VALUE)
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addComponent(jbtEndTurn)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        vRightGround1.add(jPanel3, java.awt.BorderLayout.SOUTH);

        jPanel4.setLayout(new java.awt.BorderLayout());

        jpnActions.setMinimumSize(new java.awt.Dimension(150, 150));
        jpnActions.setPreferredSize(new java.awt.Dimension(100, 150));
        jpnActions.setLayout(new java.awt.GridLayout(4, 1, 1, 1));

        jbtMove.setToolTipText("Move");
        jbtMove.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtMoveActionPerformed(evt);
            }
        });
        jpnActions.add(jbtMove);

        jbtBlock.setToolTipText("Block");
        jbtBlock.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtBlockActionPerformed(evt);
            }
        });
        jpnActions.add(jbtBlock);

        jbtBlitz.setToolTipText("Blitz");
        jbtBlitz.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtBlitzActionPerformed(evt);
            }
        });
        jpnActions.add(jbtBlitz);

        jbtPass.setToolTipText("Pass");
        jbtPass.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtPassActionPerformed(evt);
            }
        });
        jpnActions.add(jbtPass);

        jbtHandoff.setToolTipText("Handoff");
        jbtHandoff.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtHandoffActionPerformed(evt);
            }
        });
        jpnActions.add(jbtHandoff);

        jbtFoul.setToolTipText("Foul");
        jbtFoul.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtFoulActionPerformed(evt);
            }
        });
        jpnActions.add(jbtFoul);

        jPanel4.add(jpnActions, java.awt.BorderLayout.SOUTH);

        jPanel6.setLayout(new java.awt.BorderLayout());

        jPanel5.setMinimumSize(new java.awt.Dimension(100, 40));
        jPanel5.setPreferredSize(new java.awt.Dimension(100, 100));
        jPanel5.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jbt2D6.setMaximumSize(new java.awt.Dimension(30, 30));
        jbt2D6.setMinimumSize(new java.awt.Dimension(30, 30));
        jbt2D6.setPreferredSize(new java.awt.Dimension(40, 40));
        jbt2D6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbt2D6ActionPerformed(evt);
            }
        });
        jPanel5.add(jbt2D6, new org.netbeans.lib.awtextra.AbsoluteConstraints(7, 5, -1, -1));

        jbt1D6.setMaximumSize(new java.awt.Dimension(30, 30));
        jbt1D6.setMinimumSize(new java.awt.Dimension(30, 30));
        jbt1D6.setPreferredSize(new java.awt.Dimension(40, 40));
        jbt1D6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbt1D6ActionPerformed(evt);
            }
        });
        jPanel5.add(jbt1D6, new org.netbeans.lib.awtextra.AbsoluteConstraints(52, 5, -1, -1));

        jbt3D6.setMaximumSize(new java.awt.Dimension(30, 30));
        jbt3D6.setMinimumSize(new java.awt.Dimension(30, 30));
        jbt3D6.setPreferredSize(new java.awt.Dimension(40, 40));
        jbt3D6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbt3D6ActionPerformed(evt);
            }
        });
        jPanel5.add(jbt3D6, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 50, -1, -1));

        jPanel6.add(jPanel5, java.awt.BorderLayout.SOUTH);

        jPanel4.add(jPanel6, java.awt.BorderLayout.CENTER);

        vRightGround1.add(jPanel4, java.awt.BorderLayout.CENTER);

        jPanel1.add(vRightGround1, new org.netbeans.lib.awtextra.AbsoluteConstraints(780, 0, 100, 450));

        add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 880, 450));
    }// </editor-fold>//GEN-END:initComponents
    
    private void jbt3D6ActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jbt3D6ActionPerformed
    {//GEN-HEADEREND:event_jbt3D6ActionPerformed
        if (_model!=null)
        {
/*            if (_model._selectedPlayer!=null)
            {
                if (_model._selectedPlayer._currentAction!=null)
                {
                    if (_model._selectedPlayer._currentAction instanceof daBlock)
                    {
                        daBlock block=(daBlock)_model._selectedPlayer._currentAction;
                        block._chosenResult=_model._blockDice3;
                        block._step=daBlock.STEP_CHOOSE_SQUARE;
                        block.step();
                    }
                    
                    if (_model._selectedPlayer._currentAction instanceof daBlitz)
                    {
/*                        daBlitz blitz=(daBlitz)_model._selectedPlayer._currentAction;
                        blitz._block._chosenResult=_model._blockDice3;
                        blitz._block._step=daBlock.STEP_CHOOSE_SQUARE;
                        blitz.step();*/
                /*    }
                }
            }*/
        }
    }//GEN-LAST:event_jbt3D6ActionPerformed
    
    private void jbt1D6ActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jbt1D6ActionPerformed
    {//GEN-HEADEREND:event_jbt1D6ActionPerformed
        /*if (_model!=null)
        {
            if (_model._selectedPlayer!=null)
            {
                if (_model._selectedPlayer._currentAction!=null)
                {
                    if (_model._selectedPlayer._currentAction instanceof daBlock)
                    {
                        daBlock block=(daBlock)_model._selectedPlayer._currentAction;
                        block._chosenResult=_model._blockDice1;
                        block._step=daBlock.STEP_CHOOSE_SQUARE;
                        block.step();
                    }
                    
                    if (_model._selectedPlayer._currentAction instanceof daBlitz)
                    {
/*                        daBlitz blitz=(daBlitz)_model._selectedPlayer._currentAction;
                        blitz._block._chosenResult=_model._blockDice1;
                        blitz._block._step=daBlock.STEP_CHOOSE_SQUARE;
                        blitz.step();*/
               /*     }
                }
            }
        }*/
    }//GEN-LAST:event_jbt1D6ActionPerformed
    
    private void jbt2D6ActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jbt2D6ActionPerformed
    {//GEN-HEADEREND:event_jbt2D6ActionPerformed
       /* if (_model!=null)
        {
            if (_model._selectedPlayer!=null)
            {
                if (_model._selectedPlayer._currentAction!=null)
                {
                    if (_model._selectedPlayer._currentAction instanceof daBlock)
                    {
                        daBlock block=(daBlock)_model._selectedPlayer._currentAction;
                        block._chosenResult=_model._blockDice2;
                        block._step=daBlock.STEP_CHOOSE_SQUARE;
                        block.step();
                    }
                    
                    if (_model._selectedPlayer._currentAction instanceof daBlitz)
                    {
/*                        daBlitz blitz=(daBlitz)_model._selectedPlayer._currentAction;
                        blitz._block._chosenResult=_model._blockDice2;
                        blitz._block._step=daBlock.STEP_CHOOSE_SQUARE;
                        blitz.step();*/
             /*       }
                }
            }
        }*/
    }//GEN-LAST:event_jbt2D6ActionPerformed
    
    private void jbtFoulActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jbtFoulActionPerformed
    {//GEN-HEADEREND:event_jbtFoulActionPerformed
       /* if (_model._selectedPlayer!=null)
        {
            dAction action=null;
            dPlayer player=_model._selectedPlayer;
            if (player!=null)
            {
                Vector v=player.getAvailableActions();
                for (int i=0; i<v.size(); i++)
                {
                    action=(dAction)v.get(i);
                    if (action instanceof daFoul)
                    {
                        jbtFoul.setEnabled(true);
                        _model._selectedPlayer._currentAction=action;
                        action.preStep();
                        MainForm.getSingleton().repaint();
                    }
                }
            }
        }*/
    }//GEN-LAST:event_jbtFoulActionPerformed
    
    private void jbtHandoffActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jbtHandoffActionPerformed
    {//GEN-HEADEREND:event_jbtHandoffActionPerformed
       /* if (_model._selectedPlayer!=null)
        {
            dAction action=null;
            dPlayer player=_model._selectedPlayer;
            if (player!=null)
            {
                Vector v=player.getAvailableActions();
                for (int i=0; i<v.size(); i++)
                {
                    action=(dAction)v.get(i);
                    if (action instanceof daHandOff)
                    {
                        jbtHandoff.setEnabled(true);
                        _model._selectedPlayer._currentAction=action;
                        action.preStep();
                        MainForm.getSingleton().repaint();
                    }
                }
            }
        }*/
    }//GEN-LAST:event_jbtHandoffActionPerformed
    
    private void jbtPassActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jbtPassActionPerformed
    {//GEN-HEADEREND:event_jbtPassActionPerformed
       /* if (_model._selectedPlayer!=null)
        {
            dAction action=null;
            dPlayer player=_model._selectedPlayer;
            if (player!=null)
            {
                Vector v=player.getAvailableActions();
                for (int i=0; i<v.size(); i++)
                {
                    action=(dAction)v.get(i);
                    if (action instanceof daMove)
                    {
                        jbtPass.setEnabled(true);
                        _model._selectedPlayer._currentAction=action;
                        action.preStep();
                        MainForm.getSingleton().repaint();
                        
                    }
                }
            }
        }*/
    }//GEN-LAST:event_jbtPassActionPerformed
    
    private void jbtBlitzActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jbtBlitzActionPerformed
    {//GEN-HEADEREND:event_jbtBlitzActionPerformed
       /* if (_model._selectedPlayer!=null)
        {
            dAction action=null;
            dPlayer player=_model._selectedPlayer;
            if (player!=null)
            {
                Vector v=player.getAvailableActions();
                for (int i=0; i<v.size(); i++)
                {
                    action=(dAction)v.get(i);
                    if (action instanceof daBlitz)
                    {
                        jbtFoul.setEnabled(true);
                        _model._selectedPlayer._currentAction=action;
                        action.preStep();
                        MainForm.getSingleton().repaint();
                    }
                }
            }
        }*/
    }//GEN-LAST:event_jbtBlitzActionPerformed
    
    private void jbtBlockActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jbtBlockActionPerformed
    {//GEN-HEADEREND:event_jbtBlockActionPerformed
      /*  if (_model._selectedPlayer!=null)
        {
            dAction action=null;
            dPlayer player=_model._selectedPlayer;
            if (player!=null)
            {
                Vector v=player.getAvailableActions();
                for (int i=0; i<v.size(); i++)
                {
                    action=(dAction)v.get(i);
                    if (action instanceof daBlock)
                    {
                        jbtBlock.setEnabled(true);
                        _model._selectedPlayer._currentAction=action;
                        action.preStep();
                        MainForm.getSingleton().repaint();
                    }
                }
            }
        }*/
    }//GEN-LAST:event_jbtBlockActionPerformed
    
    private void jbtMoveActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jbtMoveActionPerformed
    {//GEN-HEADEREND:event_jbtMoveActionPerformed
     /*   if (_model._selectedPlayer!=null)
        {
            dAction action=null;
            dPlayer player=_model._selectedPlayer;
            if (player!=null)
            {
                Vector v=player.getAvailableActions();
                for (int i=0; i<v.size(); i++)
                {
                    action=(dAction)v.get(i);
                    if (action instanceof daMove)
                    {
                        jbtMove.setEnabled(true);
                        _model._selectedPlayer._currentAction=action;
                        action.preStep();
                        MainForm.getSingleton().repaint();
                    }
                }
            }
        }*/
    }//GEN-LAST:event_jbtMoveActionPerformed
    
    private void jbtEndTurnActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jbtEndTurnActionPerformed
    {//GEN-HEADEREND:event_jbtEndTurnActionPerformed
        _model._validated=true;
    }//GEN-LAST:event_jbtEndTurnActionPerformed
    
    public void setModel(dMatch model)
    {
        _model=model;
//        vGround1.setModel(model);
  //      vMatchBottom1.setModel(model);
    }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JButton jbt1D6;
    private javax.swing.JButton jbt2D6;
    private javax.swing.JButton jbt3D6;
    private javax.swing.JToggleButton jbtBlitz;
    private javax.swing.JToggleButton jbtBlock;
    private javax.swing.JButton jbtEndTurn;
    private javax.swing.JToggleButton jbtFoul;
    private javax.swing.JToggleButton jbtHandoff;
    private javax.swing.JToggleButton jbtMove;
    private javax.swing.JToggleButton jbtPass;
    private javax.swing.JLabel jlbRerollLeft;
    private javax.swing.JLabel jlbRerollRight;
    private javax.swing.JLabel jlbScoreLeft;
    private javax.swing.JLabel jlbScoreRight;
    private javax.swing.JLabel jlbTurnLeft;
    private javax.swing.JLabel jlbTurnRight;
    private javax.swing.JPanel jpnActions;
    private javax.swing.JPanel jpnScore;
    private javax.swing.JPanel jpnSubWest;
    private javax.swing.JPanel vRightGround1;
    // End of variables declaration//GEN-END:variables
    
    
    public void paint(Graphics g)
    {
        super.paint(g) ;
        
        jbtMove.setEnabled(false);
        jbtBlitz.setEnabled(false);
        jbtBlock.setEnabled(false);
        jbtFoul.setEnabled(false);
        jbtPass.setEnabled(false);
        jbtHandoff.setEnabled(false);
        
        if (_model!=null)
        {
/*            dPlayer player=_model._selectedPlayer;
            if (player!=null)
            {
                if (player._currentAction==null)
                {
                    Vector v=player.getAvailableActions();
                    for (int i=0; i<v.size(); i++)
                    {
                        dAction action=(dAction)v.get(i);
                        if (action instanceof daMove)
                        {
                            jbtMove.setEnabled(true);
                        }
                        
                        if (action instanceof daBlock)
                        {
                            jbtBlock.setEnabled(true);
                        }
                        
                        if (action instanceof daBlitz)
                        {
                            jbtBlitz.setEnabled(true);
                        }
                        
                        if (action instanceof daFoul)
                        {
                            jbtFoul.setEnabled(true);
                        }
                        
                        if (action instanceof daPass)
                        {
                            jbtPass.setEnabled(true);
                        }
                        
                        if (action instanceof daHandOff)
                        {
                            jbtHandoff.setEnabled(true);
                        }
                    }
                }
                else
                {
                    jbtMove.setEnabled(false);
                    jbtMove.setSelected(false);
                    jbtBlitz.setEnabled(false);
                    jbtBlitz.setSelected(false);
                    jbtBlock.setEnabled(false);
                    jbtBlock.setSelected(false);
                    jbtFoul.setEnabled(false);
                    jbtFoul.setSelected(false);
                    jbtPass.setEnabled(false);
                    jbtPass.setSelected(false);
                    jbtHandoff.setEnabled(false);
                    jbtHandoff.setSelected(false);
                    
                    if (player._currentAction instanceof daMove)
                    {
                        jbtMove.setEnabled(true);
                    }
                    if (player._currentAction instanceof daBlitz)
                    {
                        jbtBlitz.setEnabled(true);
                    }
                    if (player._currentAction instanceof daBlock)
                    {
                        jbtBlock.setEnabled(true);
                    }
                    if (player._currentAction instanceof daFoul)
                    {
                        jbtFoul.setEnabled(true);
                    }
                    if (player._currentAction instanceof daPass)
                    {
                        jbtPass.setEnabled(true);
                    }
                    if (player._currentAction instanceof daHandOff)
                    {
                        jbtHandoff.setEnabled(true);
                    }
                }
            }
            
            /*
             * Block dice display
             */
            ImageIcon picture1=null;
/*            switch(_model._blockDice1)
            {
                case daBlock.DICE_NO:
                    jbt1D6.setEnabled(false);
                    break;
                case daBlock.DICE_SKULL:
                    jbt1D6.setEnabled(true);
                    picture1=new ImageIcon(getClass().getResource("/bbos/Images/dices/aFall.gif"));
                    break;
                case daBlock.DICE_POW_SKULL:
                    jbt1D6.setEnabled(true);
                    picture1=new ImageIcon(getClass().getResource("/bbos/Images/dices/bFall.gif"));
                    break;
                case daBlock.DICE_PUSH1:
                    jbt1D6.setEnabled(true);
                    picture1=new ImageIcon(getClass().getResource("/bbos/Images/dices/curpush.gif"));
                    break;
                case daBlock.DICE_PUSH2:
                    jbt1D6.setEnabled(true);
                    picture1=new ImageIcon(getClass().getResource("/bbos/Images/dices/curpush.gif"));
                    break;
                case daBlock.DICE_POW_DODGE:
                    jbt1D6.setEnabled(true);
                    picture1=new ImageIcon(getClass().getResource("/bbos/Images/dices/dDodge.gif"));
                    break;
                case daBlock.DICE_POW:
                    jbt1D6.setEnabled(true);
                    picture1=new ImageIcon(getClass().getResource("/bbos/Images/dices/dFall.gif"));
                    break;
            }
            jbt1D6.setIcon(picture1);
            
            ImageIcon picture2=null;
            switch(_model._blockDice2)
            {
                case daBlock.DICE_NO:
                    jbt2D6.setEnabled(false);
                    break;
                case daBlock.DICE_SKULL:
                    jbt2D6.setEnabled(true);
                    picture2=new ImageIcon(getClass().getResource("/bbos/Images/dices/aFall.gif"));
                    break;
                case daBlock.DICE_POW_SKULL:
                    jbt2D6.setEnabled(true);
                    picture2=new ImageIcon(getClass().getResource("/bbos/Images/dices/bFall.gif"));
                    break;
                case daBlock.DICE_PUSH1:
                    jbt2D6.setEnabled(true);
                    picture2=new ImageIcon(getClass().getResource("/bbos/Images/dices/curpush.gif"));
                    break;
                case daBlock.DICE_PUSH2:
                    jbt2D6.setEnabled(true);
                    picture2=new ImageIcon(getClass().getResource("/bbos/Images/dices/curpush.gif"));
                    break;
                case daBlock.DICE_POW_DODGE:
                    jbt2D6.setEnabled(true);
                    picture2=new ImageIcon(getClass().getResource("/bbos/Images/dices/dDodge.gif"));
                    break;
                case daBlock.DICE_POW:
                    jbt2D6.setEnabled(true);
                    picture2=new ImageIcon(getClass().getResource("/bbos/Images/dices/dFall.gif"));
                    break;
            }
            jbt2D6.setIcon(picture2);
            
            ImageIcon picture3=null;
            switch(_model._blockDice3)
            {
                case daBlock.DICE_NO:
                    jbt3D6.setEnabled(false);
                    break;
                case daBlock.DICE_SKULL:
                    jbt3D6.setEnabled(true);
                    picture3=new ImageIcon(getClass().getResource("/bbos/Images/dices/aFall.gif"));
                    break;
                case daBlock.DICE_POW_SKULL:
                    jbt3D6.setEnabled(true);
                    picture3=new ImageIcon(getClass().getResource("/bbos/Images/dices/bFall.gif"));
                    break;
                case daBlock.DICE_PUSH1:
                    jbt3D6.setEnabled(true);
                    picture3=new ImageIcon(getClass().getResource("/bbos/Images/dices/curpush.gif"));
                    break;
                case daBlock.DICE_PUSH2:
                    jbt3D6.setEnabled(true);
                    picture3=new ImageIcon(getClass().getResource("/bbos/Images/dices/curpush.gif"));
                    break;
                case daBlock.DICE_POW_DODGE:
                    jbt3D6.setEnabled(true);
                    picture3=new ImageIcon(getClass().getResource("/bbos/Images/dices/dDodge.gif"));
                    break;
                case daBlock.DICE_POW:
                    jbt3D6.setEnabled(true);
                    picture3=new ImageIcon(getClass().getResource("/bbos/Images/dices/dFall.gif"));
                    break;
            }
            jbt3D6.setIcon(picture3);*/
        }
        
        if (_model==null)
        {
            jlbRerollLeft.setText("0");
            jlbRerollRight.setText("0");
            jlbTurnLeft.setText("0");
            jlbTurnRight.setText("0");
            jlbScoreLeft.setText("0");
            jlbScoreRight.setText("0");
        }
        else
        {
            try
            {
        /*
         * Rerolls
         */
                jlbRerollLeft.setText(Integer.toString(_model.getLeftTeam().getRerollLeft()));
                jlbRerollRight.setText(Integer.toString(_model.getRightTeam().getRerollLeft()));
                
        /*
         * Turns
         */
                jlbTurnLeft.setText(Integer.toString(_model.getLeftTeam().getTurn()));
                jlbTurnRight.setText(Integer.toString(_model.getRightTeam().getTurn()));
                
        /*
         *  Score
         */
                jlbScoreLeft.setText(Integer.toString(_model.getLeftTeam().getScore()));
                jlbScoreRight.setText(Integer.toString(_model.getRightTeam().getScore()));
            }
            catch (Exception e)
            {
                jlbRerollLeft.setText("0");
                jlbRerollRight.setText("0");
                jlbTurnLeft.setText("0");
                jlbTurnRight.setText("0");
                jlbScoreLeft.setText("0");
                jlbScoreRight.setText("0");
            }
        }
    }
}
